package com.muyu.user.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.muyu.common.core.web.page.PageQueryModel;
import com.muyu.user.service.SysUserTagService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.muyu.user.mapper.SysUserTagMapper;
import com.muyu.user.domain.SysUserTag;
import com.muyu.user.domain.model.SysUserTagQueryModel;
import com.muyu.user.domain.model.SysUserTagPageQueryModel;
import com.muyu.user.domain.model.SysUserTagSaveModel;
import com.muyu.user.domain.model.SysUserTagEditModel;

/**
 * 用户标签Service业务层处理
 *
 * @author liuguoqiang
 * @date 2025-09-14
 */
@Slf4j
@Service
public class SysUserTagServiceImpl extends ServiceImpl<SysUserTagMapper, SysUserTag>  implements SysUserTagService {

    /**
     * 查询用户标签列表
     *
     * @param pageQueryModel 用户标签
     * @return 用户标签
     */
    @Override
    public PageQueryModel<SysUserTagPageQueryModel> pageQuery(SysUserTagQueryModel pageQueryModel) {
        LambdaQueryWrapper<SysUserTag> queryWrapper = new LambdaQueryWrapper<>();
            Page<SysUserTag> page = this.page(pageQueryModel.buildPage(), queryWrapper);
        return PageQueryModel.of(page).cover(SysUserTagPageQueryModel::infoBuild);
    }


    /**
     * 查询用户标签列表
     *
     * @param pageQueryModel 用户标签
     * @return 用户标签
     */
    @Override
    public List<SysUserTag> exportList(SysUserTag pageQueryModel) {
        LambdaQueryWrapper<SysUserTag> queryWrapper = new LambdaQueryWrapper<>();
            return this.list(queryWrapper);
    }

    /**
     * 用户标签添加
     *
     * @param saveModel 用户标签
     * @return 用户标签集合
     */
    @Override
    public void save(SysUserTagSaveModel saveModel){
        this.save(SysUserTag.saveModelBuild(saveModel));
    }

    /**
     * 用户标签修改
     *
     * @param editModel 用户标签修改模型
     * @return 用户标签集合
     */
    @Override
    public void edit(SysUserTagEditModel editModel){
        this.updateById(SysUserTag.editModelBuild(editModel));
    }

    /**
     * 获取用户标签下拉框
     * @return
     */
    @Override
    public List<SysUserTag> getTagOptions() {
        return this.list();
    }
}
